﻿@model RealEstateApp.WebUI.Models.CustomerModel
@Html.ValidationSummary(true)

@{
    ViewBag.Title = "Chi tiết khách hàng";
}

<div class="page-content">
    <div class="page-header position-relative">
        <h1>Khách hàng: @Html.DisplayFor(model => model.Name)
        </h1>
    </div>
    <!--/.page-header-->

    <div class="row-fluid">
        <div class="span12">
            <!--PAGE CONTENT BEGINS-->

            <div class="row-fluid">
                <div class="span12 widget-container-span">
                    <div class="widget-box">
                        <div class="widget-header">
                            <div class="widget-toolbar no-border">
                                <ul class="nav nav-tabs" id="myTab">
                                    <li class="active">
                                        <a data-toggle="tab" href="#home">Thông tin khách hàng</a>
                                    </li>

                                    <li>
                                        <a data-toggle="tab" href="#tasks">Lịch sử giao dịch</a>
                                    </li>
                                </ul>
                            </div>
                        </div>

                        <div class="widget-body">
                            <div class="widget-main padding-6">
                                <div class="tab-content">
                                    <div id="home" class="tab-pane in active">
                                        @using (Html.BeginForm(null, null, FormMethod.Post, new { @class = "form-horizontal" }))
                                        {
                                            @Html.HiddenFor(model => model.CustomerId)
                                            <fieldset>
                                                <div class="control-group">
                                                    <div class="control-label">
                                                        @Html.LabelFor(model => model.Name)
                                                    </div>
                                                    <div class="controls">
                                                        @Html.EditorFor(model => model.Name)
                                                        @Html.ValidationMessageFor(model => model.Name)
                                                    </div>
                                                </div>

                                                <div class="control-group">
                                                    <div class="control-label">
                                                        @Html.LabelFor(model => model.BirthDate)
                                                    </div>
                                                    <div class="controls">
                                                        @Html.EditorFor(model => model.BirthDate)
                                                        @Html.ValidationMessageFor(model => model.BirthDate)
                                                    </div>
                                                </div>

                                                @*<div class="editor-label">
                        @Html.LabelFor(model => model.SalesFID)
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.SalesFID)
                        @Html.ValidationMessageFor(model => model.SalesFID)
                    </div>*@

                                                <div class="control-group">
                                                    <div class="control-label">
                                                        @Html.LabelFor(model => model.Phone)
                                                    </div>
                                                    <div class="controls">
                                                        @Html.EditorFor(model => model.Phone)
                                                        @Html.ValidationMessageFor(model => model.Phone)
                                                    </div>
                                                </div>

                                                <div class="control-group">
                                                    <div class="control-label">
                                                        @Html.LabelFor(model => model.Mobile)
                                                    </div>
                                                    <div class="controls">
                                                        @Html.EditorFor(model => model.Mobile)
                                                        @Html.ValidationMessageFor(model => model.Mobile)
                                                    </div>
                                                </div>

                                                <div class="control-group">
                                                    <div class="control-label">
                                                        @Html.LabelFor(model => model.Fax)
                                                    </div>
                                                    <div class="controls">
                                                        @Html.EditorFor(model => model.Fax)
                                                        @Html.ValidationMessageFor(model => model.Fax)
                                                    </div>
                                                </div>

                                                <div class="control-group">
                                                    <div class="control-label">
                                                        @Html.LabelFor(model => model.Email)
                                                    </div>
                                                    <div class="controls">
                                                        @Html.EditorFor(model => model.Email)
                                                        @Html.ValidationMessageFor(model => model.Email)
                                                    </div>
                                                </div>

                                                <div class="control-group">
                                                    <div class="control-label">
                                                        @Html.LabelFor(model => model.Address)
                                                    </div>
                                                    <div class="controls">
                                                        @Html.EditorFor(model => model.Address)
                                                        @Html.ValidationMessageFor(model => model.Address)
                                                    </div>
                                                </div>

                                                <div class="form-actions">
                                                    <button class="btn btn-info" type="submit">
                                                        <i class="icon-ok bigger-110"></i>
                                                        Lưu lại
                                                    </button>
                                                </div>


                                            </fieldset>
                                        }
                                    </div>

                                   
                                    <div id="tasks" class="tab-pane">
                                        @Html.Partial("_ListTask", Model)
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>

@section Top{
    <link href="@Url.Content("~/css/fullcalendar.css")" rel="stylesheet">
}

@section Bottom{
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
     <script src="@Url.Content("~/js/fullcalendar.min.js")" type="text/javascript"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            initCalendar();

            $('#tasks').on('click', '.dp-choose-date', function (event) {
                $(this).parent().find('.date-pick').datepicker('show');
            });

            $('#tasks').on('mousemove', '.dp-choose-time', function (event) {
                $(this).parent().find('.time-pick').timepicker({
                    minuteStep: 1,
                    showSeconds: false,
                    showMeridian: true
                });
            });

            $('#tasks').on('click', '.calvwz', function (event) {
                $(".tabvwz").removeClass("btn-primary");
                $(".calvwz").addClass("btn-primary");
                $(".task-table").hide();
                $(".task-calendar").show();
                $('#calendar').fullCalendar('render');
            });

            $('#tasks').on('click', '.tabvwz', function (event) {
                $(".calvwz").removeClass("btn-primary");
                $(".tabvwz").addClass("btn-primary");
                $(".task-calendar").hide();
                $(".task-table").show();
            });
        });
        
        function initCalendar() {
            
            $('#calendar').fullCalendar({
                buttonText: {
                    prev: '<i class="icon-chevron-left"></i>',
                    next: '<i class="icon-chevron-right"></i>'
                },
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay'
                },
                editable: true,
                selectable: true,
                events: {
                    url : '/Customer/GetTasks',
                    data : {  customerId : '@(Model.CustomerId)' }
                    }
            });
        }
    </script>
}